#本产品仅支持1.25及之前版本的urllib3，使用本代码前请指定安装一下版本
import requests

# 代理服务器
proxyHost = "ng001.weimiaocloud.com"
proxyPort = "9003"

# 代理隧道验证信息，订单对应处查看
proxyUser = "0Nuygy3***L5f9f"
proxyPass = "zRIMm***Qu97gw"

proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % {
  "host" : proxyHost,
  "port" : proxyPort,
  "user" : proxyUser,
  "pass" : proxyPass,
}

proxies = {
  "http"  : proxyMeta,
  "https" : proxyMeta,
}

def targetUrl():
  url = 'http://httpbin.org/ip'
  return url

def getData(i):
  headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.55 Safari/537.36',
  }
  try:
    response = requests.get(targetUrl(),headers=headers,proxies=proxies)
    response.encoding='utf-8'
    print(response.text)
    response.close()
  except requests.exceptions.RequestException as e:
    print(e)

if __name__=='__main__':
  for i in range(0,5):
    getData(i)